Product Documentation
© 2001 NuSpectra, Inc. All Rights Reserved

 

AppleScript Support

 

SiteZAP includes robust support for AppleScript -Apple's powerful and easy-to-use programming language. AppleScript was selected as the basis for communication between the Sony PTZ Camera and other Applications because of its ease-of-use, flexibility, and easy integration with other 3rd-party products. A C/C++ programmer's interface will be made available, but for the majority of uses, AppleScript is fast enough and very powerful.

Important: The SiteZAP application has an AppleScripts Menu that can contains all the scripts that have been placed in its AppleScripts folder. The AppleScripts folder must be in the same folder that the SiteZAP application is in.

Many sample AppleScripts have been provided. All of the AppleScripts can be examined by opening them using Script Editor. New scripts can be added to the AppleScripts menu at any time. We encourage you to find a good reference on AppleScript programming and learn about ways of integrating SiteZAP with other applications.

Hint: To edit or view the contents of an AppleScript, from SiteZAP, hold down the option key and select the script from the menu.

SiteZAP's AppleScript Dictionary

The AppleScript Dictionary for SiteZAP can be viewed using Script Editor by selecting Open Dictionary and selecting the SiteZAP application. The list below is a list of the major commands/properties that can be accessed via AppleScript. Always use the dictionary to find out the latest commands that are available to you.

AppleScript Commands

tell application "SiteCam"

pan left active camera by 60
goto preset active camera index 3
move active camera by { -25, 85 }

end tell

You can paste the above into a ScriptEditor document and compile it (SiteZAP should be running). When executed, it will move the camera 60 units to the left (see section on Native Camera Units), then move to preset location #4, then move -25 units of pan, and 85 units of tilt.

Properties - Getting and Setting

Get and Set commands are a feature of AppleScript. Get commands are used to get information from SiteZAP--you can get the camera location, get the auto-focus setting, or find out the current zoom setting. All camera features below can be retrieved and set.

tell application "SiteCam"
set position of active camera to {880, 300}
set tilt position of active camera to -50
set auto focus of active camera to true
set backlight of active camera to not backlight of active camera
end tell

The above AppleScript can be pasted into ScriptEditor and run. The camera will move to the absolute position 880,300. Then the camera will move to position -50. Then auto focus will be turned on. Lastly, the backlight setting will be toggled.

You can experiment with getting current values by opening ScriptEditor's Result window and executing commands such as:

tell application "SiteCam"
get position of active camera
end tell

The current camera position will show up in the Script Editor Result window. You can substitute the properties below with "position" to find out their current value.

SiteZAP Properties

power boolean -- Camera power true/false
backlight boolean -- Camera backlight mode
tracking boolean -- Camera auto tracking mode
motion detection boolean -- Camera motion detection mode
auto focus boolean -- Camera motion detection mode
Frame Display boolean -- MD Frame Display
position point -- coordinates of camera
pan position small integer -- pan position -880 to 880
tilt position small integer -- tilt position -300 to 300
zoom small integer -- zoom position
chase mode small integer -- chase mode (1-3)
focus integer -- focus level 0 to 65535
datascreen boolean -- Data screen true/false
white balance auto/indoor/outdoor/onepush -- white balance
ATMD Mode ATMDNormal/ATMode/MDMode [r/o] -- ATMD Mode (normal, AT, or MD)
MD Frame Frame1/Frame2/Frame12 [r/o] -- MD Frame (1, 2, 1&2)
AT State setting/tracking/lost [r/o] -- AT State
MD State method/setting/undetected/detected/memorizing [r/o] -- MD State
min pan small integer -- minimum pan setting
max pan small integer -- maximum pan setting
min tilt small integer -- minimum tilt setting
max tilt small integer -- maximum tilt setting
base pan amount small integer -- base pan amount 1 to 400
base tilt amount small integer -- base pan amount 1 to 400
scaled pan amount small integer -- scaled pan amount 0 to 600
scaled tilt amount small integer -- scaled tilt amount 0 to 600